using Crux.Core;
using Crux.Core.EFCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace System;
/// <summary>
/// EFCoreServiceCollectionExtensions
/// </summary>
public static class EFCoreServiceCollectionExtensions
{
    /// <summary>
    ///
    /// </summary>
    /// <param name="services"></param>
    /// <returns></returns>
    public static IServiceCollection AddEFCore(
       this IServiceCollection services)
    {
        services.TryAddSingleton(typeof(IHashProvider),typeof(XxHash64Unsafe));
        services.TryAddScoped(typeof(IUnitOfWork<>), typeof(UnitOfWork<>));
        services.TryAddScoped(typeof(IQueryRepository<>), typeof(QueryRepository<>));

        return services;
    }
}